# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# Contributor: fnord0 [fnord0 <AT> riseup <DOT> net]
# Contributor: dninja <dninja@gmail.com>
# Contributor: Jon Gjengset <jon@thesquareplanet.com>

pkgbase=lorcon
pkgname=(lorcon python-pylorcon2)
pkgver=2020.06.06
pkgrel=4
epoch=2
pkgdesc='Generic library for injecting 802.11 frames'
url='https://github.com/kismetwireless/lorcon'
license=('GPL')
arch=('loong64' 'x86_64')
makedepends=('glibc' 'python' 'libpcap')
source=("${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('1f51dc221d01356b59fd615ebccabb6d00f1999fd9450f6f092f6234635e162f0407e203df9dde4f0f942691cd9395df30377478ec677c910c2d1603228cef30')
b2sums=('6fe0d3578b8f91ed9ed0ea12ce110afc6764b694c78c57935b835e4fb8e4c4c81e07f7a8b069583382e91ef760a07bdcf3f9aa51167add052ac1f3f8c0758155')

prepare() {
  cd ${pkgbase}-${pkgver}
  autoreconf -fiv
}

build() {
  cd ${pkgbase}-${pkgver}
  ./configure \
    --prefix=/usr \
    --mandir=/usr/share/man
  make

  cd pylorcon2
  # link against locally built lorcon instead of already installed version
  export LDFLAGS+=" -L../.libs"
  python setup.py build
}

package_lorcon() {
  depends=('glibc' 'libpcap')

  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
}

package_python-pylorcon2() {
  depends=('glibc' 'python' 'lorcon')

  cd ${pkgbase}-${pkgver}/pylorcon2
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}

# vim: ts=2 sw=2 et:
